{extend name="public/home"/}
{block name='css'}
    <link rel="stylesheet" href="/static/css/withdraw.css">
    <link rel="stylesheet" href="/static/css/jquery.searchableSelect.css">
{/block}
{block name="content"}
          <div class='case'>
            <div class='roof'>
                <div class='top'>
                    <span>欢迎您{$record.contact}，当前您正在操作</span>
                    <span class='red'>帐户入金</span>
                </div>
                <div>
                    <span>你的账户账户信息：</span>
                    <span class='eng'>{$record.username}</span>
                    <span class='chn'>{$record.contact}</span>
                </div>
                <div>
                    <span>你的联络方式：</span>
                    <span class='phone'>{$record.mobile}</span>
                    <span class='email'>{$record.email}</span>
                </div>
            </div>
            <form action="" method="post">
              <div class="withdraw">
                <p><span class='red'>*</span>选择入金接口　Choose a deposit interface</p>
                <input type="hidden" name="catid" value='1'>
                <div>
                    <label>入金接口：</label>
                    {volist name="payments" id="vo"}
                    <label>
                        <input type="radio" name="interface" value="{$vo.id}" bind-url="{:url($vo['form_url'])}">
                        {$vo.pay_name}
                    </label>
                    {/volist}
                </div>
             </div>
              <div class='withdraw'>
                <p><span class='red'>*</span>输入金额&选择支付方式　Enter the amount & select a payment method</p>
                <div>
                    <label>入金金额：</label>
                    <input type="text" name='amount' required >
                </div>

              </div>
                <input type="submit" value="进入银行支付页面">
            </form>

        </div>


{/block}
{block name='script'}
<script>
    $(function(){
        $("input[name='interface']").click(function () {
           var action = $(this).attr("bind-url");
           console.log(action);
           $("form").attr("action",action);
        });
        // $('input[value=1]').attr('checked','checked');
        $('input[value=2]').attr('disabled','disabled');
        $('input[value=3]').attr('disabled','disabled');

        function checked(e){
            var radio = document.getElementById('radio');
            var radios = radio.children;
            var flag = 0;
            for(var i = 0; i < radios.length; i++) {
                if(radios[i].checked == true) {
                    flag = 1;
                    break;
                }
            }
            if(flag == 0) {
                alert('请选择付款方式');
                e.preventDefault();
            }
        }   


        $('#form').submit(function(e){
            checked(e);
        })

    });


</script>
{/block}
